#include <stdio.h>

class A {
public:
    A(): m_ptr(new int(0)) {
        printf("construct\n");
    }

    ~A() {
        printf("destruct\n");
        if (m_ptr) delete m_ptr;
    }

    A(const A&a) : m_ptr(new int(*a.m_ptr)) {
        printf("copy construct\n");
    }

    A(A&& a) : m_ptr(a.m_ptr) {
        a.m_ptr = nullptr;
        printf("move construct\n");
    }
private:
    int *m_ptr;
};


A get(bool flag) {
    A a;
    A b;
    if (flag) return a;
    else return b;
}



int main(int argc, const char **argv) {
    A a = get(false);
    return 0;
}
